#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n = 0, a[1000] = { 0 }, i = 0;
    scanf("%d", &n);
    while (n > 1)
    {
        if (n % 2 == 0)
        {
            n /= 2;
        }
        else
        {
            n = n * 3 + 1;
        }
        a[i] = n;
        i++;
    }
    for (int j=0;j<i;j++)
    {
        printf("%d ", a[j]);
    }
    printf("\n");
    printf("count = %d", i+1);
    return 0;
}